/***
    Amrita ITEWS - Copyright (C) 2009 Amrita Vishwa Vidyapeetham, Amritapuri.
                                       (http://www.amrita.edu)
    ***************************************************************************
    This file is part of the Amrita ITEWS distribution.
    Amrita ITEWS is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License (version 2) as published
    by the Free Software Foundation AND MODIFIED BY the Amrita ITEWS exception.
    ***NOTE*** The exception to the GPL is included to allow you to distribute
    a combined work that includes Amrita ITEWS without being obliged to provide
    the source code for proprietary components outside of the Amrita ITEWS
    software. Amrita ITEWS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
    Public License for more details. You should have received a copy of the GNU
    General Public License and the Amrita ITEWS license exception along with
    Amrita ITEWS if not then it can be viewed here:
    http://itews.amrita.ac.in/license.html.


    Documentation, latest information, license and contact details are at:
    http://itews.amrita.ac.in/


    Amrita ITEWS source code can be found at:
    http://code.google.com/p/itews


    The initial code-base of Amrita ITEWS was developed by Amrita Vishwa
    Vidyapeetham as part of the project titled,"Intelligent & Interactive
    Telematics using Emerging Wireless Technologies for Transport Systems
    (ITEWS)" sponsored by Technology Information Forecasting and Assessment
    Council (TIFAC), India.
***/
/*! \file lmatrix_eventq.h
    \brief LED Matrix display eventq header file.
 */

#ifndef LMATRIX_EVENTQ_H_
#define LMATRIX_EVENTQ_H_

#include <eventq.h>

/*! \brief Initialize LED matrix
 PUT event
 param (I/O): pointer to lmatrix_param_t,
        mode(I) - set to the initialization mode
        intensity(I) - intensity level
        ncols, nrows (O) - number of cols & rows of the display.
 */
#define     EVT_LMATRIX_INIT        0x00

/*! \brief Data to be displayed
 PUT event
 param: None
 buf (I): characters to be displayed (must not be greater than
 number of display cols.*/
#define     EVT_LMATRIX_PUT_DATA 0x01

/*! \brief Shutdown (power save) LED matrix.*/
#define     EVT_LMATRIX_SHUTDOWN    0x02


/*! \brief LED Matrix Modes.*/
typedef enum {
      LMATRIX_MODE_NORMAL
    , LMATRIX_MODE_SCROLL
    , LMATRIX_MODE_SELFTEST
}lmatrix_mode_t;

/*! \brief LED Matrix Initialization Params/Result.*/
typedef struct
{
    /*! \brief  */
    lmatrix_mode_t mode;

    /*! \brief Intensity. */
    uint8 intensity;

    /*! \brief number of char-rows (result). */
    int16 nrows;

    /*! \brief number of char-columns (result). */
    int16 ncols;

}lmatrix_param_t;

/*! \brief LMatrix Event Queue Operation Structure Global Variable.*/
extern eventq_ops_t lmatrix_eventq_ops;

/*SPI*/
STATUS lmatrix_eventq_open      ( eventq_ctx_t *, const char *eventq_name );
STATUS lmatrix_eventq_close     ( eventq_ctx_t * );
STATUS lmatrix_eventq_sync_put  ( eventq_ctx_t *, event_t *, HRESULT *res );
STATUS lmatrix_eventq_sync_get  ( eventq_ctx_t *, event_t * );


#endif /*LMATRIX_EVENTQ_H_*/
